<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org/">
<head th:replace="page/index::head">

</head>
<body class="layui-layout-body layuimini-all">
<div class="layui-layout layui-layout-admin">
    <!--头部-->
    <div class="layui-header header" th:replace="page/index::nav">

    </div>
    <!--左边栏-->
    <div class="layui-side layui-bg-black" th:replace="page/index::left">

    </div>
    <!--中间部分-->
    <div class="layui-body">
        <div class="layuimini-content-page">

            <!--初始化中间内容 welcome页面-->
            <div class="layuimini-container layui-anim layui-anim-upbit">

                <div class="layuimini-main content">
                    <div class="layui-table-box">
                        <!--表头-->
                        <div class="layui-table-header">
                            <table class="layui-table layui-table-page" cellspacing="0" cellpadding="0" border="0">
                                <thead>
                                <tr>

                                    <th data-field="number" data-key="1-0-1" class="">
                                        <div class="layui-table-cell laytable-cell-1-0-1"><span>ID</span></div>
                                    </th>
                                    <th data-field="username" data-key="1-0-2" class="">
                                        <div class="layui-table-cell laytable-cell-1-0-2"><span>用户名</span></div>
                                    </th>
                                    <th data-field="datetime" data-key="1-0-3" data-minwidth="100" class="">
                                        <div class="layui-table-cell laytable-cell-1-0-3"><span>登录时间</span></div>
                                    </th>
                                    <th data-field="msg" data-key="1-0-4" class="">
                                        <div class="layui-table-cell laytable-cell-1-0-4"><span>登录信息</span></div>
                                    </th>
                                    <th data-field="10" data-key="1-0-5" data-minwidth="50"
                                        class=" layui-table-col-special">
                                        <div class="layui-table-cell laytable-cell-1-0-10" align="center">
                                            <span>操作</span></div>
                                    </th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                        <div class="layui-table-body">
                            <table class="layui-table" cellspacing="0" cellpadding="0" border="0">
                                <tbody>
                                <tr data-index="0" class="" th:each="loginfo:${pageInfo.getList()}">

                                    <td data-field="number" data-key="1-0-1" class="">
                                        <div class="layui-table-cell laytable-cell-1-0-1"
                                             th:text="${loginfoStat.count}">10000
                                        </div>
                                    </td>
                                    <td data-field="username" data-key="1-0-2" class="">
                                        <div class="layui-table-cell laytable-cell-1-0-4" th:text="${loginfo.username}">
                                            user-0
                                        </div>
                                    </td>
                                    <td data-field="datetime" data-key="1-0-3" data-minwidth="100" class="">
                                        <div class="layui-table-cell laytable-cell-1-0-5">
                                            <span th:text="${#dates.format(loginfo.loginTime,'yyyy-MM-dd HH:mm')}">2019-02-05</span>
                                        </div>
                                    </td>
                                    <td data-field="msg" data-key="1-0-4" class="">
                                        <div class="layui-table-cell laytable-cell-1-0-8" th:text="${loginfo.msg}">
                                            提示信息-0
                                        </div>
                                    </td>

                                    <td data-field="10" data-key="1-0-5" data-content="" data-minwidth="50"
                                        class="layui-table-col-special" align="center">
                                        <div class="layui-table-cell laytable-cell-1-0-10">
                                            <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete"
                                               lay-event="delete" th:href="@{/user/del_log/(log_id=${loginfo.logId})}">删除</a>
                                        </div>
                                    </td>
                                </tr>

                                </tbody>
                            </table>
                        </div>
                        <div class="layui-table-page">
                            <div>

                                <a class="layui-btn layui-btn-normal prePage" th:if="${pageInfo.hasPreviousPage}"
                                   style="float: left"
                                   th:href="@{/user/log_info(pageNum=${pageInfo.pageNum-1})}">上一页</a>
                                <div style="left: 500px;width: 100px;height: 50px;position: absolute">
                                    当前第<a>&nbsp;<span class="layui-laypage-curr" id="currentPage"
                                                      th:text=" ${pageInfo.pageNum} "></span>&nbsp;</a>页
                                    <p>共<span th:text="${pageInfo.pages}"></span>页</p>
                                </div>
                                <a class="layui-btn layui-btn-normal nextPage" th:if="${pageInfo.hasNextPage}"
                                   style="float: right"
                                   th:href="@{/user/log_info(pageNum=${pageInfo.pageNum+1})}">下一页</a>
                            </div>

                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>

</div>

<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" src="../../static/lib/jquery-3.4.1/jquery-3.4.1.min.js"
        charset="utf-8"></script>
<script th:src="@{/lib/layui-v2.5.5/layui.js?v=1.0.4}" src="../../static/lib/layui-v2.5.5/layui.js?v=1.0.4"
        charset="utf-8"></script>
<script th:src="@{/js/lay-config.js?v=1.0.4}" src="../../static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.session@1.0.0/jquery.session.min.js"></script>
<script type="text/javascript">

    layui.use(['element', 'layer', 'layuimini'], function () {

        $('.login-out').on("click", function () {
            layer.msg('正在退出登录', function () {
                window.location = '/user/logout';
            });
        });
        layuimini.listen();
    });
    $(".view_notice").click(function () {
        console.log('1234');
        $.get("/notice/getFirstNotice",function (result) {
            result = result.data;
            $(".publish h1").html(result.noticeTitle);
            $(".publish p").html(result.noticeContent);
            layer.open({
                type: 1
                , title: '公告' //不显示标题栏
                , closeBtn: false
                , area: '300px;'
                , shade: 0.8
                , id: 'notice-publish' //设定一个id，防止重复弹出
                , resize: false
                , btn: ['我知道了']
                , btnAlign: 'c'
                , moveType: 1 //拖拽模式，0或者1
                , content:$(".publish")

            });
        });
        /*  */
    })
    /*头像上传*/
    $(".uploadAvatar").click(function () {
        layer.open({
            type: 1
            , title: '上传头像' //不显示标题栏
            , closeBtn: 2
            , area: '300px;'
            , id: 'upload-avatar' //设定一个id，防止重复弹出
            , resize: false
            , btnAlign: 'c'
            , moveType: 1 //拖拽模式，0或者1
            , content: $(".magt3")

        });
        layui.use('upload', function () {
            var upload = layui.upload;
            var uploadInst = upload.render({
                elem: '#test1'
                ,auto:true

                , url: '/user/projectPictureUpload'
                , method: 'post'
                , accept: 'images'
                , acceptMime: 'image/*'
                , field: 'projectImg'
                ,before: function(obj){
                    //预读本地文件示例，不支持ie8
                    obj.preview(function(index, file, result){
                        $("#demo1").attr('src',result);
                    })}
                , done: function (res) {
                    //如果上传失败
                    if (res.status == 1) {
                        return layer.msg('上传项目图片失败', {icon: 5});
                    }
                    //上传成功,获得图片地址
                    console.log(res.data);

                    $('.avatar').attr('src', res.data);
                    layer.closeAll();
                    // window.location.reload();
                }
                , error: function () {
                    //演示失败状态，并实现重传
                    var demoText = $('#demoText');
                    demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                    demoText.find('.demo-reload').on('click', function () {
                        uploadInst.upload();
                    });
                }
            });
        });
    });
</script>

</body>

<div class="publish" style="padding: 50px; line-height: 22px;
background-color: #393D49; color: #fff; font-weight: 300;">
    <h1></h1><br><br>
    <p>

    </p>
</div>
<!--上传头像框-->
<div class="layui-form layui-form-item magt3">

    <div class="layui-upload">
        <button type="button" class="layui-btn" style="margin-left: 100px;" id="test1">选择图片</button>
        <div class="layui-upload-list">
            <img class="layui-upload-img" id="demo1" style="margin-left:80px;width: 140px;height: 115px;">
            <p id="demoText"></p>
        </div>

    </div>

</div>

</html>
